/**
 * Copyright 厦门中软海晟信息技术有限公司 版权所有 违者必究 2019
 */
package com.vijos;

/**
 *
 *@author : sunzb(sunzb@hsit.com.cn)
 *@date: 2019/4/17
 */
//乒乓球
public class P2_1_1217 {

    public static String test(String input) {
        // 11分制
        char[] chars = input.toCharArray();
        StringBuilder result = new StringBuilder();
        int wCount = 0;
        int lCount = 0;
        for (int i = 0; i < chars.length; i++) {
            char value = chars[i];
            if (value == 'W') {
                wCount++;
            }
            if (value == 'L') {
                lCount++;
            }
            if ((wCount >= 11 || lCount >= 11) &&
                    Math.abs(wCount - lCount) >= 2) {
                result.append('[').append(wCount).append(':')
                        .append(lCount).append("] ");
                wCount = 0;
                lCount = 0;
            }
        }
        if (wCount > 0 || lCount > 0) {
            result.append('[').append(wCount).append(':')
                    .append(lCount).append("] ");
        }
        return result.toString();
    }

    public static void main(String[] args) {
        System.out.println(test("WWWLLLLLWWWLWLWLWLLWWLWLWWW"));
    }
}
